'use strict';
const bcrypt = require('bcryptjs')

/** @type {import('sequelize-cli').Migration} */
module.exports = {
    async up(queryInterface, Sequelize) {
        const userArr = [
            {
                email: 'admin@qq.com',
                username: 'admin',
                password: bcrypt.hashSync('123456', 10),
                nickname: '管理员',
                sex: 2,
                role: 100,
                createdAt: new Date(), updatedAt: new Date()
            },
            {
                email: 'user1@qq.com',
                username: 'user1',
                password: '111111',
                nickname: '普通用户1',
                sex: 1,
                role: 0,
                createdAt: new Date(), updatedAt: new Date()
            },
            {
                email: 'user2@qq.com',
                username: 'user2',
                password: '222222',
                nickname: '普通用户2',
                sex: 0,
                role: 0,
                createdAt: new Date(), updatedAt: new Date()
            }
        ]
        await queryInterface.bulkInsert('Users', userArr, {});
    },

    async down(queryInterface, Sequelize) {
        await queryInterface.dropTable('Users');
    }
};
